<?php

namespace app\admin\controller;
use app\common\model\DrawLog as DrawLogModel;

class DrawLog extends Admin
{

    function index(){
        if (!$this->request->isPost()){
            return view('index');
        }else{
            $limit  = $this->request->post('limit', 20, 'intval');
            $page = $this->request->post('page', 1, 'intval');
            $order  = $this->request->post('order', '', 'serach_in');	//排序字段
            $sort  = $this->request->post('sort', '', 'serach_in');		//排序方式

            $where = [];
            $where['level_id'] = $this->request->post('level', '', 'intval');
            $where['source'] = $this->request->post('source', '', 'serach_in');
            $where['mid'] = $this->request->post('mid', '', 'intval');

            $orderby = ($sort && $order) ? $sort.' '.$order : 'id desc';
            //获取用户等级列表
            $res = DrawLogModel::getList($orderby,$limit,$page,formatWhere($where));

            $data['status'] = 200;
            $data['data'] = $res;
            return json($data);
        }
    }

}